# Importing Data
AUSTRALIA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "C1:C264")

# Checking the Imported Data
View(AUSTRALIA)
# Creating Time Series Data
AUSTRALIA_ts <- ts(AUSTRALIA, start=c(1998,1), end=c(2018,12), frequency=12)
# Viewing and Checking the Created Time Series Data
AUSTRALIA_ts
sum(is.na(AUSTRALIA_ts))
library(forecast)
AUSTRALIA_ts <- tsclean(AUSTRALIA_ts)
AUSTRALIA_ts

# Identification: Plotting the Time Series Data
plot(AUSTRALIA_ts)

# Estimating the appropriate model
AUSTRALIA_ts_model <- auto.arima(AUSTRALIA_ts)
AUSTRALIA_ts_model

# Forecasting
options(max.print=1000000)
AUSTRALIA_ts_forecast <- forecast (AUSTRALIA_ts_model, level=c(95), h=364)
plot(AUSTRALIA_ts_forecast)
AUSTRALIA_ts_forecast             

# Exporting
write.table(AUSTRALIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/AUSTRALIA_TSA.csv", sep=",")
